
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="referrer" content="never">
  <meta content="telephone=no" name="format-detection"/>
  <meta name="x5-orientation" content="portrait">
  <meta name="screen-orientation" content="portrait">
  <meta name="viewport"
        content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=yes">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>油站上线审批</title>
  <link href="#" rel="shortcut icon">
  <link rel="icon" href="data:;base64,=">
  <link rel="stylesheet" type="text/css" href="//img.ejiayou.com/activity/images/boon/company/reset.css"/>
  <link rel="stylesheet" type="text/css" href="//img.ejiayou.com/activity/pages/platform/soulList/css/toast.css"/>
  <link rel="stylesheet" href="css/index.css"/>
  <link rel="stylesheet" type="text/css" href="css/station_submit.css"/>
  <script type="text/javascript">
    eval(function (p, a, c, k, e, r) {
      e = function (c) {
        return c.toString(a)
      }
      if (!''.replace(/^/, String)) {
        while (c--) r[e(c)] = k[c] || e(c)
        k = [function (e) {
          return r[e]
        }]
        e = function () {
          return '\\w+'
        }
        c = 1
      }

      while (c--)
        if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c])
      return p
    }('(6(a,d){j b=a.i,e="3"f 5?"3":"9",c=6(){b.7.8=(2>b.4?b.4:2)/2*g+"h"};a.0&&(d.0(e,c,!1),a.0("k",c,!1))})(l,5);', 22, 22, 'addEventListener||750|orientationchange|clientWidth|window|function|style|fontSize|resize||||||in|64|px|documentElement|var|DOMContentLoaded|document'.split('|'), 0, {}))
  </script>
  <style type="text/css">
    body {
      background: #F5F5F5;
      -webkit-text-size-adjust: 100% !important;
    }

    ::-webkit-input-placeholder {
      /* Chrome/Opera/Safari */
      color: #CCCCCC;
    }

    ::-moz-placeholder {
      /* Firefox 19+ */
      color: #CCCCCC;
    }

    :-ms-input-placeholder {
      /* IE 10+ */
      color: #CCCCCC;
    }

    :-moz-placeholder {
      /* Firefox 18- */
      color: #CCCCCC;
    }

    .app_show {
      width: 100%;
    }

    .hj_banner {
      width: 100%;
      height: 6.88rem;
      background-size: 100% 100%;
      background-image: url("https://img.ejiayou.com/upload/2021/1/c2a19491-af61-4028-8259-e06b4505b60a-1611992592354.png");
      background-repeat: no-repeat;
    }

    .content {
      width: 10.78rem;
      height: 9.34rem;
      background: #FFFFFF;
      border-radius: 0.25rem;
      margin: -4.53rem auto 0 auto;
      display: flex;
      flex-flow: column;
      align-items: center;
    }

    .btn {
      width: 8.75rem;
      height: 1.56rem;
      background: linear-gradient(318deg, #FF9100 0%, #FFA400 100%);
      border-radius: 0.19rem;
      font-size: 0.56rem;
      font-weight: 600;
      line-height: 1.56rem;
      margin-top: 1.25rem;
      color: #FFFFFF;
      text-align: center;
    }

    input {
      border-radius: 0.13rem;
      outline: none;
      width: 8.75rem;
      height: 1.56rem;
      font-size: 0.44rem;
      padding-left: 0.47rem;
      box-sizing: border-box;
      border: none;
      display: block;
    }

    .get-code {
      width: 2.5rem;
      line-height: 1.125rem;
      font-size: 0.4rem;
      border-radius: unset;
      border: none;
      color: #6C3D05;
      display: inline-block;
      text-align: center;
      background-color: #FFFFFF;
      margin-left: -2.5rem;
    }

    .get-codelhj {
      width: 3rem;
      line-height: 0.63rem;
      font-size: 0.44rem;
      border: none;
      color: #177EEB;
      display: inline-block;
      text-align: center;
      position: absolute;
      right: 0.2rem;
      padding-left: 0 !important;
      border-radius: 0 !important;
      top: 0.55rem;
      height: 0.63rem;
      border-left: 0.03rem solid #CCCCCC;
    }

    input[type="button"] {
      -webkit-appearance: none;
      background: #fff;
      border-radius: 0;
    }

    input[type="text"] {
      border-radius: 0;
    }

    .body_mask {
      width: 100%;
      height: 100%;
      position: fixed;
      background: #ffffff;
      z-index: 999;
      left: 0;
      right: 0;
    }

    .title {
      width: 100%;
      height: 2rem;
      font-size: 0.56rem;
      font-weight: 600;
      color: #333333;
      line-height: 2rem;
      text-align: center;
    }
  </style>
</head>
<body>
<div id="app">
  <div class="body_mask" v-if='body_show'></div>
  <div class="app_show" v-if="showUserLogin">
    <div class="hj_banner"></div>
    <div class="content">
      <div class="title">身份认证</div>
      <div style="border: 0.03rem solid #CCCCCC;border-radius: 0.13rem;">
        <input pattern="[0-9]*" maxlength="11" placeholder="请输入手机号" v-model="userPhone" readonly @blur="onBlur"
               type="tel">
      </div>
      <div style="margin-top: 0.47rem;position: relative;border: 0.03rem solid #CCCCCC;border-radius: 0.13rem;">
        <input style="border-radius: 0.13rem;" type="text" maxlength="6" placeholder="请输入验证码" v-model="sms_code"
               @blur="onBlur">
        <input type="button" id="get_code" value="获取验证码" class="get-codelhj" :disabled="hadGet?'disabled':false"
               :value="sms_text" @click="getSmsCode">
      </div>
      <div class="btn" @click="login()">立即登录</div>
    </div>
  </div>
  <div class="app_show" v-if="showStationInfo">
    <div class="title_tip">
      尊敬的{{json_list.managerName}}，非常高兴您能与易加油合作，以下信息为
      合作的相关信息，请您确认审批上线。
    </div>
    <van-cell class="grey_cell">长期优惠信息</van-cell>
    <div v-for="(item, index) in oilPrice">

      <van-cell class="cell_bold" :title="'结算优惠'+(index+1)"></van-cell>
      <van-cell title="日期" :value="item.dates"></van-cell>
      <van-cell title="时间段" :value="item.times"></van-cell>
      <van-cell class="cell_bold" title="油站结算价"></van-cell>
      <van-cell title="92#(元/升)" :value="item.stationSettlePrice92" v-if="item.stationSettlePrice92"></van-cell>
      <van-cell title="95#(元/升)" :value="item.stationSettlePrice95" v-if="item.stationSettlePrice95"></van-cell>
      <van-cell title="98#(元/升)" :value="item.stationSettlePrice98" v-if="item.stationSettlePrice98"></van-cell>
      <van-cell title="0#(元/升)" :value="item.stationSettlePrice0" v-if="item.stationSettlePrice0"></van-cell>
    </div>
    <van-cell class="cell_bold" title="油枪信息"></van-cell>
    <div v-for="(oil_item, index) in json_list.oilInfo">
      <van-cell :title="oil_item.name" :value="oil_item.oilgunCode"></van-cell>
    </div>
    <!-- <div v-for="(commission_item, commission_index) in commissionPrice">

      <van-cell class="cell_bold" :title="'抽佣信息'+(commission_index+1)"></van-cell>
      <van-cell title="日期" :value="commission_item.dates"></van-cell>
      <van-cell title="时间段" :value="commission_item.dateTime"></van-cell>

      <van-cell title="92#(元/升)" :value="commission_item.oil92" v-if="commission_item.oil92"></van-cell>
      <van-cell title="95#(元/升)" :value="commission_item.oil95" v-if="commission_item.oil95"></van-cell>
      <van-cell title="98#(元/升)" :value="commission_item.oil98" v-if="commission_item.oil98"></van-cell>
      <van-cell title="0#(元/升)" :value="commission_item.oil0" v-if="commission_item.oil0"></van-cell>
    </div> -->
    <!--			<van-cell class="cell_margin" title="油站上合作平台：" :value="json_list.isPlatform?'是':'否'"></van-cell>-->
    <!--			<van-cell title="油站手续费：" :value="json_list.stationFee +'%'"></van-cell>-->
    <!--			<van-cell title="上线时间：" :value="json_list.onLineTime"></van-cell>-->
    <!--      新-->
    <van-cell class="cell_bold" title="对账信息"></van-cell>
    <van-cell title="油站账户名：" :value="json_list.accountName"></van-cell>
    <van-cell title="银行户名：" :value="json_list.bankAccount"></van-cell>
    <van-cell title="支行名称：" :value="json_list.bankBranch"></van-cell>
    <!--<van-cell title="是否油站合作方：" :value="json_list.isPlatform?'是':'否'"></van-cell>-->
    <van-cell title="平台服务费：" :value="json_list.stationFee +'%'"></van-cell>
    <van-cell title="银行服务费：" value="1元/笔"></van-cell>
    <van-cell title="上线时间：" :value="json_list.onLineTime"></van-cell>
    <!--      旧-->
    <van-cell title="审批结果：" :value="station_handle_state==1?'同意':'不同意'" v-if="station_handle_state!=0"></van-cell>
    <van-cell title="审批时间" :value="station_update_time" v-if="station_handle_state!=0"></van-cell>
    <div class="submit_box_step" v-if="station_handle_state ==0">
      <van-button square type="primary" native-type="button" @click="rebackToLast">取消上线</van-button>
      <van-button square type="primary" @click="submitShangxian" native-type="button">确认上线</van-button>
    </div>
    		    <van-popup v-model="showPopUp">
    		    	<div class="submit_box">
    		    		<div class="submit_title">确认上线</div>
    		    		<div class="submit_button">
    		    			<div class="button_one" @click="showPopUp=false"><span>取消</span></div>
    		    			<div class="button_two" @click="submitShangx"><span>确认</span></div>
    		    		</div>
    		    	</div>
    		    </van-popup>
      </div>
    </van-popup>
  </div>
</div>
</body>
<script type="text/javascript" src="//img.ejiayou.com/activity/pages/platform/soulList/js/jquery.js"></script>
<script type="text/javascript" src="//img.ejiayou.com/activity/images/groupon/common.js?v=1"></script>
<script type="text/javascript" src="//img.ejiayou.com/activity/pages/platform/soulList/js/vue.js"></script>
<script src="js/vant.min.js"></script>
<script src="js/utils.js" type="text/javascript" charset="utf-8"></script>
<script src="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script>
<script type="text/javascript">
  // var vConsole = new VConsole();
  var work_order_id = getQueryVariable('work_order_id') || ''
  var vm = new Vue({
    el: '#app',
    data: {
      activityHost: (window.location.origin.indexOf('dev.ejiayou.com') != -1 ? window.location.origin : '//finance.ejiayou.com'),
      mobile: '',
      sms_text: '获取验证码',
      sms_code: '',
      hadGet: false,
      userId: 0,
      login_status: false,
      body_show: true,
      work_order_id: work_order_id,
      userPhone: '',
      showUserLogin: false,
      showStationInfo: false,
      showPopUp: false,
      json_list: '',
      resData: '',
      station_update_time: '',
      station_handle_state: 0,
      oilPrice: [],
      commissionPrice: []
    },
    created: function () {
      var that = this
      that.login_status = sessionStorage.getItem('sessionStorage_station_id') || ''

    },
    mounted: function () {
      this.getStationOil()
      this.getFormData()
    },
    methods: {
      onBlur: function () {
        //解决ios12 并且微信6.7.4版本，软件盘弹出的bug
        setTimeout(function () {
          var scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0
          window.scrollTo(0, Math.max(scrollHeight - 1, 0))
        }, 100)
      },
      getStationAuditTime: function (fn) {
        var self = this
        var data = {
          work_order_id: this.work_order_id
        }
        $.ajax({
          url: '/eapi/v1/activity/work/station_audit_time?t=' + new Date().getTime(),
          data: data,

          type: 'post',
          dataType: 'json',
          success: function (res) {
            console.log(res)
            if (res.status == 200) {
              self.station_update_time = res.data.time
            }
          }
        })

      },
      getFormData: function (fn) {
        var self = this
        var data = {
          admin_id: 0,
          work_order_id: this.work_order_id,
          type: 2
        }
        $.ajax({
          url: '/eapi/v1/activity/work/approval_flow?t=' + new Date().getTime(),
          data: data,

          type: 'post',
          dataType: 'json',
          success: function (res) {
            console.log(res)
            if (res.status == 200) {
              var resData = res.data
              var json_list = JSON.parse(resData.work_order.content)
              self.resData = resData
              self.json_list = json_list
              self.userPhone = json_list.phone
              self.station_handle_state = resData.work_order.station_handle_state

              self.getStationAuditTime()
              self.body_show = false
              self.login_status = sessionStorage.getItem('sessionStorage_station_id')
              if (self.login_status) {
                self.showStationInfo = true
                self.showUserLogin = false
              } else {
                self.showStationInfo = false
                self.showUserLogin = true
              }
            }
          }
        })

      },
      getStationOil: function () {
        var self = this
        $.ajax({
          url: this.activityHost + '/cwxt/onlineStation/getStationOilPriceAndCommission?workOrderId=' + this.work_order_id + '&isCache=0',

          type: 'get',
          // dataType: 'json',
          success: function (res) {
            console.log(res)
            if (res.success == true) {
              var resData = res.data
              self.commissionPrice = resData.commissionPrice
              self.oilPrice = resData.oilPrice
            }
          }
        })
      },
      getSmsCode: function () {
        var that = this
        // if (this.mobile == '') {
        //     ejyToast.showToast(1, '请输入手机号码')
        //     return
        // } else if (!(/^0\d{2,3}-?\d{7,8}$/.test(this.mobile)) && this.mobile.length != 11) {
        //     ejyToast.showToast(1, '请输入正确的手机号码')
        //     return
        // }
        $.ajax({
          url: '/eapi/v1/activity/common/getPhoneCode',
          data: {
            mobile: that.userPhone
          },
          type: 'POST',
          dataType: 'json',
          success: function (res) {
            var data = res.data
            if (res.success == true) {
              that.hadGet = true
              var time = 60
              that.sms_text = time + 's' + '后获取'
              var myCount = setInterval(function () {
                time--
                that.sms_text = time + 's' + '后获取'
                if (time <= 0) {
                  that.sms_text = '获取验证码'
                  that.hadGet = false
                  clearInterval(myCount)
                }
              }, 1000)
            } else {
              that.hadGet = false
              ejyToast.showToast(1, res.error.message)
            }
          },
          error: function (res) {
            that.hadGet = false
            ejyToast.showToast(1, res.error.message)
          }
        })
      },

      rebackToLast: function () {
        var self = this
        this.submitApproval(2, function () {
          self.showPopUp = false
          self.getFormData()
        })
      },
      submitShangxian: function () {
        this.showPopUp = true
      },
      submitShangx: function () {
        var self = this
        this.submitApproval(1, function () {
          self.showPopUp = false
          self.getFormData()
        })
      },
      submitApproval: function (status, fn) {
        vant.Toast.loading({ message: '提交数据中', forbidClick: true, duration: 0 });

        var self = this
        var data = {

          work_order_id: this.work_order_id,
          admin_id: 0,

          audit: status
        }
        $.ajax({
          url: '/eapi/v1/activity/work/exchange_node',
          data: data,

          type: 'post',
          dataType: 'json',
          success: function (res) {
            console.log(res)
            vant.Toast.clear()

            if (res.status == 200) {
              var resData = res.data
              if (fn) {
                fn()
              }
            }
          },
          error: function (err) {
            vant.Toast.clear()

            vant.Toast('上线失败')
          }
        })
      },
      login: function () {
        var that = this
        if (!that.sms_code) {
          vant.Toast('请输入验证码')
          return false
        }
        var data = {

          sms_code: that.sms_code,
          mobile: that.userPhone,
          work_order_id: that.work_order_id
        }
        $.ajax({
          url: '/eapi/v1/activity/work/station_login',
          data: data,
          type: 'POST',
          dataType: 'json',
          success: function (res) {
            console.log(res)
            var resData = res.data
            if (res.status == 200) {

              sessionStorage.setItem('sessionStorage_station_id', 1)

              that.showStationInfo = true
              that.showUserLogin = false
            }
          },
          error: function (res) {
            var resData = JSON.parse(res.responseText)
            vant.Toast(resData.error.message)
          }
        })
      },
    }
  })
</script>
</html>